<!DOCTYPE html>
<html lang="zh-CN">
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<meta name="description" content="自定义QQ分享生成器 - 简洁、直观、强悍的QQ分享生成工具，让自定义QQ分享更迅速、简单。">
	<meta name="keywords" content="QQ, share, DIY">
	<meta name="author" content="晨旭 <lolicon@papapoi.com>">

	<title>自定义QQ分享生成器</title>
	<link rel="shortcut icon" href="http://source.papapoi.com/www&@favicon.ico">
	<link rel="stylesheet" href="http://cdn.bootcss.com/bootstrap/2.3.2/css/bootstrap.min.css">

	<script src="http://cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script>
	<script src="http://cdn.bootcss.com/bootstrap/2.3.2/js/bootstrap.min.js"></script>
	<script type="text/javascript">
	var base64EncodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
	var base64DecodeChars = new Array(
	-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
	-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
	-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63,
	52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1,
	-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
	15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1,
	-1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
	41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1);
	//base64编码
	function base64encode(str) {
	var out, i, len;
	var c1, c2, c3;
	len = str.length;
	i = 0;
	out = "";
	while(i < len) {
	c1 = str.charCodeAt(i++) & 0xff;
	if(i == len)
	{
	out += base64EncodeChars.charAt(c1 >> 2);
	out += base64EncodeChars.charAt((c1 & 0x3) << 4);
	out += "==";
	break;
	}
	c2 = str.charCodeAt(i++);
	if(i == len)
	{
	out += base64EncodeChars.charAt(c1 >> 2);
	out += base64EncodeChars.charAt(((c1 & 0x3)<< 4) | ((c2 & 0xF0) >> 4));
	out += base64EncodeChars.charAt((c2 & 0xF) << 2);
	out += "=";
	break;
	}
	c3 = str.charCodeAt(i++);
	out += base64EncodeChars.charAt(c1 >> 2);
	out += base64EncodeChars.charAt(((c1 & 0x3)<< 4) | ((c2 & 0xF0) >> 4));
	out += base64EncodeChars.charAt(((c2 & 0xF) << 2) | ((c3 & 0xC0) >>6));
	out += base64EncodeChars.charAt(c3 & 0x3F);
	}
	return out;
	}

	//utf8转utf16，以便支持中文base64转码
	function utf16to8(str) {
	var out, i, len, c;
	out = "";
	len = str.length;
	for(i = 0; i < len; i++) {
	c = str.charCodeAt(i);
	if ((c >= 0x0001) && (c <= 0x007F)) {
	out += str.charAt(i);
	} else if (c > 0x07FF) {
	out += String.fromCharCode(0xE0 | ((c >> 12) & 0x0F));
	out += String.fromCharCode(0x80 | ((c >> 6) & 0x3F));
	out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));
	} else {
	out += String.fromCharCode(0xC0 | ((c >> 6) & 0x1F));
	out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));
	}
	}
	return out;
	}

	function formSubmitClick() {
	var val1 = document.getElementById('input1').value,
		val2 = document.getElementById('input2').value;
		val3 = document.getElementById('input3').value;
		val4 = document.getElementById('input4').value;
	  if (!val1) {
		alert('标题不能为空!');
		return;
	}
	if (!val2) {
		alert('内容不能为空!');
		return;
	}
	if (!val3) {
		alert('来自信息不能为空!');
		return;
	}
	if (!val4) {
		alert('图片网址不能为空!');
		return;
	}
	val1=base64encode(utf16to8(val1));
	val2=base64encode(utf16to8(val2));
	alert("生成成功！请点击下面的分享链接！");
	document.getElementById("getok").innerHTML="<p class=\"text-center\"><a href=\"http://connect.qq.com/widget/shareqq/index.html?url=http://qqshare.papapoi.com/"+val1+"/o/"+val2+"&k=YOzK2k&desc=&title=不必理会此处，直接分享&summary=不必理会此处，直接分享&pics="+val4+"&site="+val3+"&style=201&width=32&height=32\" target=\"_blank\">点击即可分享！</a></p>";
	}
	</script>
</head>
<body>


<div class="container-fluid">
	<div class="row-fluid">
		<div class="span12">
			<h3 class="text-center">
				<strong><span>自定义QQ分享生成器</span></strong>
			</h3>
		</div>
	</div>
	<div class="row-fluid">
		<div class="span12">
			<h5 class="text-center">
				<strong><span>欢迎加入收藏夹~</span></strong>
			</h5>
		</div>
	</div>
	<div class="row-fluid">
		<div class="span6">
			<p class="text-right">
				<span>各部分说明↓↓↓↓↓↓↓↓</span>
			</p>
			<p class="text-right">
				<img alt="" src="http://ww1.sinaimg.cn/mw690/c03c4ee6gw1f15lat4mkyj20co09fgmb.jpg" />
			</p>
		</div>
		<div class="span6">
			<p class="text-left">
				↓↓↓↓↓↓↓↓↓↓举例
			</p>
			<p class="text-left">
				<img alt="" src="http://ww4.sinaimg.cn/mw690/c03c4ee6gw1f15lasjy0xj20bw07qq35.jpg" />
			</p>
		</div>
	</div>
	<div class="row-fluid">
		<div class="span12">
			<form id="form" class="form-inline">
			<p class="text-center">
				标题：<input id="input1" type="text" style="width:100%;" /><br />建议不超过10个字<br /> 内容：<input id="input2" type="text" style="width:100%;"/><br />建议不超过30字，否则可能导致分享失败<br /> 来自信息：<input id="input3" type="text" style="width:100%;"/><br /><br /> 图片网址：<input id="input4" type="text" style="width:100%;"/><br />(建议到免费外链图片网站获取图片外链，<a href="http://tietuku.com/upload" target="_blank">点我去免费图床</a>)<br />
			</p>
			</form> <button class="btn btn-info btn-block btn-large" type="button" onclick="formSubmitClick()">点我生成链接</button><br>
			<div id='getok'></div>
		</div>
	</div>
	<div class="row-fluid">
		<div class="span12">
			<p>	<div class="row-fluid">
		<div class="span12">
			<p class="text-center">
				本站由<a href="http://www.chenxublog.com" target="_blank">晨旭</a>提供支持<br>
				<a href="http://www.chenxublog.com/2016/02/15/diy-qq-share.html" target="_blank">点我提交建议和汇报问题</a><br>
				<a href="http://www.miitbeian.gov.cn/" target="_blank">苏ICP备15008986号</a>
			</p>
		</div>
	</div>
	<div class="row-fluid">
		<div class="span6">
			<p class="text-right">
				<img src='http://i12.tietuku.com/683e05e6796e2ed5.png'/>
			</p>
		</div>
		<div class="span6">
			<p class="text-left">
				<img src='http://i12.tietuku.com/683e05e6796e2ed5.png'/>
			</p>
		</div>
	</div>
	<div class="row-fluid">
		<div class="span12">
			<div class="ds-thread" data-thread-key="1" data-title="自定义QQ分享生成器" data-url="http://qqshare.papapoi.com/"></div>
			<script type="text/javascript">var duoshuoQuery={short_name:"qqsharediy"};(function(){var ds=document.createElement('script');ds.type='text/javascript';ds.async=true;ds.src=(document.location.protocol=='https:'?'https:':'http:')+'//static.duoshuo.com/embed.js';ds.charset='UTF-8';(document.getElementsByTagName('head')[0]||document.getElementsByTagName('body')[0]).appendChild(ds)})();</script>
		</div>
	</div>
</div>
</body>